home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16153 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: gaia.ns.utk.edu!mbk
  2. From: mbk@caffeine.engr.utk.edu (Matt Kennel)
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Re: Will Java kill C++?
  5. Followup-To: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  6. Date: 9 Apr 1996 19:58:29 GMT
  7. Organization: University of Tennessee, Knoxville and Oak Ridge National Laboratory
  8. Message-ID: <4kefh5$cc4@gaia.ns.utk.edu>
  9. References: <Dp5J6n.F2K@news.hawaii.edu> <4jno9v$css@newsbf02.news.aol.com> <3162FD33.61F7@uh.edu>
  10. Reply-To: kennel@msr.epm.ornl.gov
  11. NNTP-Posting-Host: caffeine.engr.utk.edu
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. Jeff M Younker (jeff@uh.edu) wrote:
  15. : Brian Rogoff wrote:
  16. : > How about the ability to create new value types? Not necessarily
  17. : > low-level, as Ada 95, Eiffel, and Sather allow this, yet prevent
  18. : > the pointer madness of C and C++ (please, there is no language
  19. : > "C/C++"). Who needs this? Anyone who needs fast, compact arrays
  20. : > of user defined elements.  This means anyone who needs to write
  21. : > numerical methods, signal processing, and certain fast graphics
  22. : > algorithms in the language.
  23. : > ...
  24. : > We are already seeing the complaints on this newsgroup :-)
  25.  
  26. : Value types are really cool from a conceptual point of view, but
  27. : I am not so sure that they are necessary to achieve fast numerical
  28. : code.  If my understanding is correct, Fortran 77 (the premiere
  29. : language of high speed code) treats integers, floats and complex
  30. : numbers as references.  I have yet to hear anyone complain about
  31. : the speed of Fortran code.  From this I would conclude that what
  32. : really matters is the quality of the compiler, not the
  33. : semantics of the language.
  34.  
  35. This is not true.  Fortran scalars and array elements are not shared
  36. references. 
  37.  
  38. For instance if I say
  39.  
  40.           I = 2
  41.           J = I
  42.           I = 3
  43.  
  44. then "J" is not '3', it is still 2.  This is not so important for
  45. scalars like this, but it is critical if you want to believe that
  46. A(I+J) is distinct from A(J+K) if I+J .ne. J+K.
  47.  
  48. In a purely reference language *all* elements of an array could point to
  49. the same underlying storage location.  This completely kills optimization. 
  50.  
  51. This is not possible in Fortran.  
  52.  
  53. (Yes there is "EQUIVALENCE" which is a grody hack but still not reference
  54.  semanatics, but the language then warns people to use it at their own risk
  55.  and does the standard optimization assuming unshared anyway.)
  56.  
  57. What Fortran does have is argument passing to subroutines by
  58. reference for scalars.  This is not as consequential. 
  59.  
  60.  
  61. : - Jeff Younker - jeff@uh.edu - These are my views, not those of UH -
  62.